//
//  CALayer+Extension.m
//  DDFish
//
//  Created by 糖otk on 2017/8/17.
//  Copyright © 2017年 Burining. All rights reserved.
//

#import "CALayer+Extension.h"

@implementation CALayer (Extension)
+ (CAShapeLayer *)setTopRightCornerAndTopLeftCornerBounds: (CGRect )bounds Angle: (CGFloat)angle {
    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:bounds byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(angle, angle)];
    CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
    maskLayer.frame  = bounds;
    maskLayer.path = maskPath.CGPath;
    return maskLayer;
}

+ (CAShapeLayer *)setBottomRightCornerAndBottomLeftCornerBounds: (CGRect )bounds Angle: (CGFloat)angle {
    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(angle, angle)];
    CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
    maskLayer.frame  = bounds;
    maskLayer.path = maskPath.CGPath;
    return maskLayer;
}
@end
